/*
 * eparser.c
 *
 *  Created on: 2013-5-19
 *      Author: xkaying
 */

#include "../typedef/token.h"

void EParser(Lexer *lexer)
{
	Token *ptoken;
	ptoken = LexerGetToken(lexer);
	int state;
	state = 0;
	while (ptoken) {
		switch (state)
		{
			case 0: {
				switch (ptoken->type)
				{
					case TokenKey_PACKAGE: {
						if(PackageAsm(lexer))
							continue;
						return;
					}
					case TokenType_Comment: {
						ptoken = LexerGetToken(lexer);
						continue;
					}
					default: {
						printf("第%d行:未知的翻译规则.\n", ptoken->line);
						return;
					}
				}
				printf("eparser状态机错误.状态%d.\n", state);
				return;
			}
			default: {
				printf("eparser状态机错误.状态(default):%d.\n", state);
				return;
			}
		}
	}
}
